package com.shekhar.random.learnings.puzzlers;

public class ShutdownHookPuzzle {
	
	private static final Object lock = new Object();

	public static void main(String... args) {
		Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
			@Override
			public void run() {
				System.out.println("Locking");
				synchronized (lock) {
					System.out.println("Locked");
				}
			}
		}));
		synchronized (lock) {
			System.exit(0);
		}
	}

}
